<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Java resource bundle</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Java_resource_bundle"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Java_resource_bundle rootpage-Java_resource_bundle skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Java resource bundle</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">See also: <a href="Resource_(Java)" title="Resource (Java)">Resource (Java)</a></div>
<p>A resource bundle is a <a href="Java_(software_platform)" title="Java (software platform)">Java</a> <a href=".properties" title=".properties">.properties</a> file that contains <a href="Locale_(computer_software)" title="Locale (computer software)">locale</a>-specific data.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> It is a way of internationalising a Java application by making the code locale-independent.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Benefits_of_using_resource_bundles">Benefits of using resource bundles</h2></div>
<p>Extracting locale-sensitive objects such as strings from the code (as opposed to <a href="Hard-coding" class="mw-redirect" title="Hard-coding">hard-coding</a> them) means that the application can handle multiple locales without having to write different code for each locale. It also means that translators can deal with just the translatable text and not the programming code. Therefore, using resource bundles improves the <a href="Internationalisation" class="mw-redirect" title="Internationalisation">internationalisation</a> and the <a href="Internationalization_and_localization" title="Internationalization and localization">localisation</a> process of a software product.
</p>
<div class="mw-heading mw-heading2"><h2 id="Translating_a_resource_bundle">Translating a resource bundle</h2></div>
<p>Some <a href="Computer-assisted_translation" title="Computer-assisted translation">CAT</a> tools like <a href="OmegaT" title="OmegaT">OmegaT</a>, OmegaT+,<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> <a href="Swordfish_Translation_Editor" title="Swordfish Translation Editor">Swordfish</a> or Sun's <a href="Open_language_tools" class="mw-redirect" title="Open language tools">Open language tools</a> can specifically handle resource bundles. In addition to these, translators can use any <a href="Text_editor" title="Text editor">text editor</a> to create new resource bundles or to modify existing ones.
</p>
<div class="mw-heading mw-heading2"><h2 id="Tools_to_create_resource_bundles">Tools to create resource bundles</h2></div>
<p>The <a rel="nofollow" class="external text" href="http://www.tmasoft.de/MessageCompiler/index.html">Message Compiler</a> <sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> is a tool to generate resource bundle files from a single source file containing localized text definitions in different languages. The Message Compiler creates also constant definitions for the keys used to access the localized texts with the methods of the <a href="Java_(programming_language)" title="Java (programming language)">Java</a> class <a rel="nofollow" class="external text" href="http://docs.oracle.com/javase/6/docs/api/java/util/ResourceBundle.html?is-external=true">ResourceBundle (6)</a>, <a rel="nofollow" class="external text" href="https://docs.oracle.com/javase/7/docs/api/java/util/ResourceBundle.html">ResourceBundle (7)</a> and <a href="HTML" title="HTML">HTML</a> documentation pages for each language.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Bundled_software" class="mw-redirect" title="Bundled software">Bundled software</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFO'Conner" class="citation web cs1">O'Conner, John. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20070103035343/http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/">"Java Internationalization: Localization with ResourceBundles"</a>. <i>Sun Developer Network</i>. Archived from <a rel="nofollow" class="external text" href="http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/">the original</a> on 2007-01-03<span class="reference-accessdate">. Retrieved <span class="nowrap">2020-11-16</span></span>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://omegatplus.sourceforge.net/">OmegaT+</a></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.tmasoft.de/MessageCompiler/index.html">Message Compiler</a></span>
</li>
</ol></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2024-11-04" href="https://en.wikipedia.org/wiki/?title=Java_resource_bundle&oldid=1255385183">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>